[id].vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <!-- @format -->
  2. <script lang="ts" setup>
  3. import dayjs from 'dayjs'
  4. import { getOrderDetailApi } from '@/api/model/order'
  5. import { downloadFileByA } from '@/utils/common/download'
  6. const detail = ref()
  7. const visible = ref(false)
  8. const curProduct = ref()
  9. const totalQuantity = computed(() => {
  10. let total = 0
  11. if (!detail.value)
  12. return total
  13. detail.value.merchandises.forEach((item: any) => {
  14. total += item.quantity
  15. })
  16. return total
  17. })
  18. const totalPrice = computed(() => {
  19. let total = 0
  20. if (!detail.value)
  21. return total
  22. detail.value.merchandises.forEach((item: any) => {
  23. total += item.subTotalPrice
  24. })
  25. return total.toFixed(2)
  26. })
  27. async function getOrderDetail() {
  28. try {
  29. const id = useRoute().params.id
  30. const res: any = await getOrderDetailApi({ id })
  31. detail.value = res
  32. }
  33. catch (error) {
  34. console.log(error)
  35. }
  36. }
  37. function onCancelSubmit() {
  38. console.log('cancel')
  39. }
  40. function openRemark(row: any) {
  41. if (row.file) {
  42. const fileArr = row.file.split(',')
  43. curProduct.value = { ...row, ...{ file: fileArr } }
  44. }
  45. visible.value = true
  46. }
  47. function getFileTitle(file: string) {
  48. const fileArr = file.split('/')
  49. return fileArr[fileArr.length - 1]
  50. }
  51. getOrderDetail()
  52. </script>
  53. <template>
  54. <div>
  55. <div class="w-1400px mx-auto pt-40px pb-220px">
  56. <div
  57. class="fw-700 text-#333 text-24px text-#111 mb-30px flex justify-between items-center"
  58. >
  59. <div>Wish order detail ({{ detail?.billNo }})</div>
  60. <el-button
  61. v-if="detail?.state === 1"
  62. class="!bg-#C58C64 !text-#fff !ml-0 !w-172px !h-42px !text-14px !fw-500 !b-rd-6px"
  63. @click="onCancelSubmit"
  64. >
  65. Cancel Wish order
  66. </el-button>
  67. </div>
  68. <div class="flex gap-56px text-#666">
  69. <div>No: {{ detail?.billNo }}</div>
  70. <div>
  71. Date: {{ dayjs(detail?.createTime).format("YYYY-MM-DD hh:mm:ss") }}
  72. </div>
  73. <div>
  74. Status:
  75. <span class="text-#0068FF fw-500">
  76. {{ detail?.state === 1 ? "Submitted" : "Cancelled" }}</span>
  77. </div>
  78. <!-- <div>Order Total: {{ numberToTwoDecimals(detail?.totalPrice) }} USD</div> -->
  79. </div>
  80. <div class="mt-34px mb-28px">
  81. <div
  82. class="w-full py-24px px-16px b-dashed b-1px b-#E0E0E0 b-rd-4px "
  83. >
  84. <div v-if="detail?.quote">
  85. <div class="fw-700 text-#3D3D3D">
  86. Quotation for product
  87. </div>
  88. <div class="mt-20px mb-28px">
  89. <div v-for="item in detail?.quote?.attachments" :key="item.id" class="py-4px underline cursor-pointer" @click="downloadFileByA(item.fileUrl, item.fileName)">
  90. {{ getFileTitle(item.fileUrl) }}
  91. </div>
  92. </div>
  93. <div class="fw-700 my-20px text-#3D3D3D">
  94. Remark
  95. </div>
  96. <div class="text-#333">
  97. {{ detail?.quote?.remark }}
  98. </div>
  99. </div>
  100. <div v-else class="flex justify-center items-center">
  101. <svgo-quotation class="!w-28px !h-28px mr-14px" />
  102. No quotation yet
  103. </div>
  104. </div>
  105. </div>
  106. <div>
  107. <div class="fw-500 text-24px text-#333 mb-20px">
  108. Product
  109. </div>
  110. <div class="overflow-y-auto">
  111. <el-table :data="detail?.merchandises" style="width: 100%">
  112. <el-table-column prop="title" label="Product" width="300">
  113. <template #default="{ row }">
  114. <div class="flex items-center">
  115. <el-image
  116. style="width: 56px; height: 56px; margin-right: 16px"
  117. :src="row.masterImage.split(',')[0]"
  118. fit="cover"
  119. />
  120. <div class="w-180px line-clamp-2">
  121. {{ row.title }}
  122. </div>
  123. </div>
  124. </template>
  125. </el-table-column>
  126. <el-table-column prop="brandName" label="Item No." width="180" />
  127. <el-table-column prop="quantity" label="Quantity" />
  128. <el-table-column prop="unitPrice" label="UnitPrice" />
  129. <el-table-column prop="subTotalPrice" label="Total" />
  130. <el-table-column label="Remark">
  131. <template #default="{ row }">
  132. <svgo-remark
  133. class="!w-24px cursor-pointer !h-24px text-#0068FF"
  134. @click="openRemark(row)"
  135. />
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. <div class="py-30px px-40px b-1px b-solid b-#E0E0E0 bg-#F7F8FA flex justify-end text-14px">
  141. Product Quantity <span class="fw-500">&nbsp; {{ totalQuantity }}</span>&nbsp;&nbsp;&nbsp; Total Price USD<span class="fw-500">&nbsp; {{ totalPrice }}</span>
  142. </div>
  143. <!-- <div class="mt-25px flex justify-end">
  144. <el-pagination
  145. v-model:current-page="currentPage"
  146. :page-size="page_size"
  147. :pager-count="10"
  148. layout="prev, pager, next" :total="total"
  149. @change="changePage"
  150. />
  151. </div> -->
  152. </div>
  153. </div>
  154. <business-account-orders-remark-modal
  155. v-if="visible"
  156. v-model:visible="visible"
  157. v-model:product="curProduct"
  158. :order-id="detail.id"
  159. />
  160. <common-footer-guide />
  161. </div>
  162. </template>
  163. <style lang="less" scoped>
  164. ::v-deep(.el-table) {
  165. color: #333;
  166. .el-table__header-wrapper {
  167. .el-table__header {
  168. height: 50px;
  169. .el-table__cell {
  170. color: #333;
  171. font-weight: 400 !important;
  172. background-color: #fff2e1;
  173. }
  174. }
  175. }
  176. .el-table__row {
  177. height: 68px;
  178. &.warning-row {
  179. --el-table-tr-bg-color: #f7f7f7;
  180. }
  181. }
  182. }
  183. </style>